#include <GL/gl.h>
#include <GL/glu.h>
#include <glx/glext.h>

#include "robot.h"

#include <vector>
using std::vector;

extern PFNGLGENBUFFERSARBPROC glGenBuffers;
extern PFNGLBINDBUFFERPROC glBindBuffer;
extern PFNGLBUFFERDATAPROC glBufferData;

#pragma pack(push, 1)

struct Vertex;
struct Color;

#pragma pack(pop)

class Floor {
public:
    enum Buffers {
        VERTEX_BUFFER = 0,
        INDEX_BUFFER,
        COLOR_BUFFER,
        LAST_BUFFER
    };

    Floor();

    bool initialize();
    void render();

private:

    vector<Vertex> m_vertices;
    vector<unsigned int> m_indices;

    static const int RED_OFFSET = 0;
    static const int BLUE_OFFSET = sizeof(Color) * 8;
    static const int YELLOW_OFFSET = sizeof(Color) * 16;
    static const int WHITE_OFFSET = sizeof(Color) * 24;

    vector<Color> m_colorBuffer;

    GLuint m_vbos[LAST_BUFFER];

    void initializeVertexBuffer();
    void initializeVertexColors();
};
